package javalession;

import com.sun.tools.javac.parser.Scanner;

public class Lession2 {

		private static Scanner scan;

		public static void main(String[] args) {
				double score;
				double sum = 0;
				int num = 0;
				scan = new Scanner(System.in);
				while (true) {
					System.out.println("请输入成绩:");
					score=scan.nextInt();
					if(score==0) {
						break;
					}
					if (score<0 || score>100) {
					System.out.println("成绩录入有误，请重新输入！");
				}
				sum=sum+score;
				num++;
				}
				System.out.println("sum:"+sum);
				System.out.println("平均分："+sum/num);
			}
		}
}
